﻿// -----------------------------------------------------------------------
// <copyright file="ConfigurationManagerAdapter.cs" company="CompDJ">
//     Copyright (c) CompDJ. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------

namespace CompDJ.Web.Abstractions
{
    using System.Collections.Specialized;
    using System.Configuration;

    /// <summary>ConfigurationManager adapter.</summary>
    /// <remarks>By default, this class cannot be unit tested, as it is an 
    /// adapter for the real thing. Plus, there is no actual logic in here.</remarks>
    [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
    public partial class ConfigurationManagerAdapter : IConfigurationManager
    {
        /// <summary>Initializes a new instance of the ConfigurationManagerAdapter class.</summary>
        public ConfigurationManagerAdapter()
        {
        }
     
        public virtual NameValueCollection AppSettings
        {
            get { return ConfigurationManager.AppSettings; }
        }

        public virtual ConnectionStringSettingsCollection ConnectionStrings
        {
            get { return ConfigurationManager.ConnectionStrings; }
        }

        public virtual object GetSection(string sectionName)
        {
            return ConfigurationManager.GetSection(sectionName);
        }

        public virtual Configuration OpenExeConfiguration(ConfigurationUserLevel userLevel)
        {
            return ConfigurationManager.OpenExeConfiguration(userLevel);
        }

        public virtual Configuration OpenExeConfiguration(string exePath)
        {
            return ConfigurationManager.OpenExeConfiguration(exePath);
        }

        public virtual Configuration OpenMachineConfiguration()
        {
            return ConfigurationManager.OpenMachineConfiguration();
        }

        public virtual Configuration OpenMappedExeConfiguration(ExeConfigurationFileMap fileMap, ConfigurationUserLevel userLevel)
        {
            return ConfigurationManager.OpenMappedExeConfiguration(fileMap, userLevel);
        }

        public virtual Configuration OpenMappedMachineConfiguration(ConfigurationFileMap fileMap)
        {
            return ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
        }

        public virtual void RefreshSection(string sectionName)
        {
            ConfigurationManager.RefreshSection(sectionName);
        }
    }
}
